home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Plurals / debug.h < prev    next >
C/C++ Source or Header  |  1991-11-28  |  1KB  |  45 lines

  1. /*
  2.  *    Debugging
  3.  *
  4.  *    Author:    S.C.Merrall
  5.  *
  6.  *    File:    debug.h
  7.  *
  8.  *    Contents:    init_debug - initialise debugging
  9.  *                      DBG_CALL   - register function entry
  10.  *                      DBG_ARGS   - list argument values
  11.  *                      DBG_EXIT   - register function exit
  12.  *
  13.  *    Description:    This supplies a concise trace system which can be
  14.  *                      witched on and off in files by including debug_off.h
  15.  *                      instead of debug.h
  16.  *
  17.  *    Change History:
  18.  *
  19.  *    Date   Name Comment
  20.  *    -------- ---- -------
  21.  *    06:02:91 SCM  Created
  22.  *
  23.  */
  24.  
  25. extern FILE *dbg;        
  26. extern char *dbg_g_fname;
  27.  
  28. #ifdef __STDC__
  29.  
  30. extern int init_debug( char * );
  31.  
  32. #else
  33.  
  34. extern int init_debug();
  35.  
  36. #endif
  37.  
  38. #define DBG_CALL(name) char *old_dbg_fname=dbg_g_fname;char *dbg_fname = name;\
  39.                        dbg_g_fname = dbg_fname 
  40. #define DBG_ARGS(args) fprintf(dbg,"%s(",dbg_fname);args;fprintf(dbg,")\n")
  41. #define DBG_EXIT(out)  fprintf(dbg,"%s => ",dbg_fname);out;fprintf(dbg,"\n");\
  42.                        dbg_g_fname=old_dbg_fname
  43.  
  44. #define DBG_NULL(ptr)  if (ptr == NULL) fprintf(dbg,"WARNING: NULL pointer in %s called from %s\n",dbg_fname,old_dbg_fname);
  45.